package com.axzhengxin.platform.axcube.controller;

import cn.hutool.core.util.StrUtil;
import com.axzhengxin.platform.axcube.service.IAxCubeService;
import com.axzhengxin.platform.axcube.transf.EntInfoListQueryRequest;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * AxCubeController
 * 安信魔方API
 *
 * @author jiangnan
 * @date 2021/3/18
 */
@Slf4j
@RestController
@RequestMapping(path = "/ax-cube")
public class AxCubeController extends BaseController {

    private IAxCubeService axCubeService;

    public AxCubeController(IAxCubeService axCubeService) {
        this.axCubeService = axCubeService;
    }

    @GetMapping(path = "/list")
    public TableDataInfo list(EntInfoListQueryRequest request) {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        int pageNum = pageDomain.getPageNum() - 1;
        int pageSize = pageDomain.getPageSize();
        return axCubeService.getEntList(request, pageNum, pageSize);
    }

    @GetMapping(path = "/jbxx")
    public AjaxResult jbxx(@RequestParam("entName") String entName) {
        return AjaxResult.success(axCubeService.getEntInfo(entName));
    }

    @GetMapping(path = "/gdjczdj/{entId}")
    public TableDataInfo gdjczdj(@PathVariable("entId") String entId) {
        return getDataTable(axCubeService.getGdjczdj(entId));
    }

    @GetMapping(path = "/zyry/{entId}")
    public TableDataInfo zyry(@PathVariable("entId") String entId) {
        return getDataTable(axCubeService.getZyry(entId));
    }

    @GetMapping(path = "/jbxxbg/{entId}")
    public TableDataInfo jbxxbg(@PathVariable("entId") String entId) {
        return getDataTable(axCubeService.getJbxxbg(entId));
    }

    @GetMapping(path = "/jyyc/{entId}")
    public TableDataInfo jyyc(@PathVariable("entId") String entId) {
        return getDataTable(axCubeService.getJyyc(entId));
    }

    @GetMapping(path = "/xzcf/{entId}")
    public TableDataInfo xzcf(@PathVariable("entId") String entId) {
        return getDataTable(axCubeService.getXzcf(entId));
    }

    @GetMapping(path = "/xzxk/{entId}")
    public TableDataInfo xzxk(@PathVariable("entId") String entId) {
        return getDataTable(axCubeService.getXzxk(entId));
    }

    @GetMapping(path = "/gqczdj/{entId}")
    public TableDataInfo gqczdj(@PathVariable("entId") String entId) {
        return getDataTable(axCubeService.getGqczdj(entId));
    }

    @GetMapping(path = "/dcdydj/{entId}")
    public TableDataInfo dcdydj(@PathVariable("entId") String entId) {
        return getDataTable(axCubeService.getDcdydj(entId));
    }

    @GetMapping(path = "/dwtz/{entId}")
    public TableDataInfo dwtz(@PathVariable("entId") String entId) {
        return getDataTable(axCubeService.getDwtz(entId, StrUtil.EMPTY));
    }

}
